<template>
  <div class="yx-input">
    <input type="text" @input="inpChange" />
    <div class="text"><slot name="text"></slot></div>
    <div class="icon"><slot name="icon"></slot></div>
  </div>
</template>
<script>
export default {
  props: {
    modelValue: String,
  },
  setup(props, ctx) {
    const inpChange = (e) => {
      ctx.emit("update:modelValue", e.target.value);
      //调用父组件传来的update事件 更新modelValue  更新为 当前input 输入的内容
    };
    return {
      inpChange,
    };
  },
};
</script>
<style lang="scss" scoped>
.yx-input {
  width: 270px;
  height: 50px;
  background: #f5f5f5;
  font-size: 12px;
  color: #333;
  border-radius: 5px;
  display: flex;
  padding: 0 20px;
  justify-content: space-between;
  align-items: center;
  input {
    width: 170px;
    height: 30px;
    border: none;
    background-color: rgba(0, 0, 0, 0) !important;
  }
  .text {
    font-size: 18px;
    color: #e12c1e;
  }
  .icon {
    font-size: 16px;
    color: #d1cfce;
  }
}
</style>
